package social.hub.api.facebook;

public class FacebookPrivateMessage {

	private String	appId			= "287751607926567";
	private String	picture			= "http://stage.sistemacomker.com.br/static/web/images/master/head.logo.png";
	private String	name			= "Teste%20Comker";
	private String	description		= "Teste%20Comker%20description";
	private String	redirect_uri	= "http%3A%2F%2Frc.sistemacomker.com.br%2Fweb%2Fpub%2Findex.html";

	public String getPrivateMessageUrl(String[] facebookIds) {
		return buildPrivateMessageUrl(facebookIds);
	}

	private String buildPrivateMessageUrl(String[] facebookIds) {

		String url = "https://www.facebook.com/dialog/send?"
				+ "api_key=" + appId
				+ "&app_id=" + appId
				+ "&description=" + description
				+ "&display=popup&link=http%3A%2F%2Frc.sistemacomker.com.br%2Fweb%2Fpub%2Findex.html"
				+ "&name=" + name
				+ "&picture=" + picture
				+ "&redirect_uri=" + redirect_uri
				+ "&to=" + buildPropertyTo(facebookIds);

		return url;
	}

	private String buildPropertyTo(String[] facebookIds) {
		String to = "";
		if (facebookIds.length > 0) {
			to = facebookIds[0];

			for (int i = 1; i < facebookIds.length; i++) {
				to += "%2C" + facebookIds[i];
			}
		}
		return to;
	}
}
